﻿package mortal.game.view.rebate.openNewSerSevenDay.panels
{
    import baseEngine.modifiers.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import flash.geom.*;
    import frEngine.primitives.object2d.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.component.window.*;
    import mortal.game.manager.*;
    import mortal.game.manager.window3d.*;
    import mortal.game.resource.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.model.pools.*;
    import mortal.game.view.common.*;
    import mortal.game.view.interfaceCallModule.*;
    import mortal.game.view.rebate.openServerSevenDay.data.*;
    import mortal.mvc.interfaces.*;

    public class OpenNewSerSevRight extends BaseWindow
    {
        protected var _bg:GImageBitmap;
        protected var _tip2:GTextFiled;
        protected var _tip1:GTextFiled;
        protected var _rect3d:Rect3DObject;
        private var _img2d:Img2D;
        private var _effectPlayer1:EffectPlayer;
        private var _effectPlayer2:EffectPlayer;
        private var _wid:int = 363;
        private var _hei:int = 556;
        private var _powArr:Array;
        private static var _instance:OpenNewSerSevRight;

        public function OpenNewSerSevRight(param1:ILayer = null)
        {
            this._powArr = [5000, 3000];
            super(param1);
            setSize(365, 602);
            this.layer = LayerManager.windowLayer3D;
            title = "" + Language.getString(71826);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap(ImagesConst.OpenNewSerSevZRBg, 7, 36, null, this.onBgLoadCompl);
            this._tip2 = UIFactory.gTextField("" + Language.getString(71827), 42, 558, 300, 25, this, GlobalStyle.textFormatLv.setSize(13).center());
            this._tip1 = UIFactory.gTextField("" + Language.getString(71827), 40, 233, 300, 25, this, GlobalStyle.textFormatLv.setSize(13).center());
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._bg = null;
            this._tip2 = null;
            this._tip1 = null;
            if (this._rect3d)
            {
                this._rect3d.disposeObj3d(this._effectPlayer1);
                this._rect3d.disposeObj3d(this._effectPlayer2);
                this._rect3d.removeImg(this._img2d);
                this._effectPlayer1 = null;
                this._effectPlayer2 = null;
                this._img2d = null;
                Rect3DManager.instance.disposeRect3d(this._rect3d);
                this._rect3d = null;
            }
            super.disposeImpl(param1);
            return;
        }// end function

        protected function onBgLoadCompl() : void
        {
            if (isDisposed)
            {
                return;
            }
            this.add3DRect();
            this.add3dBg();
            this.add3DModel();
            return;
        }// end function

        protected function add3DRect() : void
        {
            if (this._rect3d == null)
            {
                this._rect3d = Rect3DManager.instance.registerWindow(true, new Rectangle(7, 36, this._wid, this._hei), this);
            }
            Rect3DManager.instance.windowShowHander(null, this);
            return;
        }// end function

        protected function add3dBg() : void
        {
            if (this._rect3d)
            {
                this._rect3d.removeImg(this._img2d);
                this._img2d = new Img2D(null, this._bg.bitmapData, new Rectangle(0, 0, this._wid, this._hei), false);
                this._rect3d.addImg(this._img2d);
            }
            return;
        }// end function

        private function add3DModel() : void
        {
            UITrackPanelSub1.window = this;
            var _loc_1:* = OpenServerSevenDayUtil.getEffByDay(-7);
            if (this._effectPlayer1)
            {
                this._effectPlayer1.dispose();
                this._rect3d.disposeObj3d(this._effectPlayer1);
            }
            this._effectPlayer1 = EffectPlayerPool.instance.getEffectPlayer(_loc_1, null, this._rect3d.renderList, false);
            this._effectPlayer1.hangBoneName = BoneConst.MountHangModelBone;
            this._effectPlayer1.play(PlayMode.ANIMATION_LOOP_MODE);
            this._rect3d.addObject3d(this._effectPlayer1, 183, 113);
            this._effectPlayer1.name = "openEffectPlayer1";
            _loc_1 = OpenServerSevenDayUtil.getEffByDay(-4);
            if (this._effectPlayer2)
            {
                this._effectPlayer2.dispose();
                this._rect3d.disposeObj3d(this._effectPlayer1);
            }
            this._effectPlayer2 = EffectPlayerPool.instance.getEffectPlayer(_loc_1, null, this._rect3d.renderList, false);
            this._effectPlayer2.hangBoneName = BoneConst.MountHangModelBone;
            this._effectPlayer2.play(PlayMode.ANIMATION_LOOP_MODE);
            this._rect3d.addObject3d(this._effectPlayer2, 183, 435);
            this._effectPlayer2.name = "openEffectPlayer2";
            return;
        }// end function

        override protected function onWindowDownHandler(event:MouseEvent) : void
        {
            return;
        }// end function

        override protected function onMouseMoveHandler(event:MouseEvent) : void
        {
            return;
        }// end function

        public static function get instance() : OpenNewSerSevRight
        {
            if (_instance == null)
            {
                _instance = new OpenNewSerSevRight;
            }
            return _instance;
        }// end function

        public static function isViewShow() : Boolean
        {
            return _instance != null && !_instance.isHide;
        }// end function

    }
}
